-
-
Notifications
You must be signed in to change notification settings - Fork 677
Optimize PrevEventIDs
when getting thousands of backwards extremeties
#3308
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #3308 +/- ##
==========================================
- Coverage 65.50% 65.34% -0.16%
==========================================
Files 509 509
Lines 57493 57514 +21
==========================================
- Hits 37659 37585 -74
- Misses 15960 16030 +70
- Partials 3874 3899 +25
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs more documentation, the general idea LGTM though.
roomserver/api/perform.go
Outdated
} | ||
prevEventIDs = util.UniqueStrings(prevEventIDs) | ||
// If we still have > 100 eventIDs, only return the first 100 | ||
if len(prevEventIDs) > 100 { | ||
return prevEventIDs[:100] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, arbitrary and needs justification. Also need to justify why we just spent all this time getting 1000 only to take 100 of them. At what point would a map[string]struct{}
be better than this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like map[string]struct{}
has the best results - 1 more alloc compared to the "original" change and otherwise much better, see updated PR description.
…ckfill-prev-eventIDs
Changes how many
PrevEventIDs
we send to other servers when backfilling, capped to 100 events.Unsure about how representative this benchmark is..